<template>
  <div class="app-container">
    <el-card class="box-card">
      <div style="text-align: center">
        <div>
          <el-button type="primary" class="btn" @click="daying" :disabled=garbage>打印</el-button>
          设置起始页码：
          <input
            v-model="pageStartNumber"
            autocomplete="off"
            spellcheck="false"
            type="text"
            placeholder=""
            class="tiwen"
            oninput="value=value.replace(/[^0-9.]/g,'')"
            style="width: 100px"
          />
          <el-button
            type="primary"
            class="btn_"
            @click="toPage('up')"
            v-if="start == 1"
            disabled
          >上一页
          </el-button
          >
          <el-button
            type="primary"
            class="btn_"
            @click="toPage('up')"
            v-if="start != 1"
            :disabled=garbage
          >上一页
          </el-button
          >
          第
          <input
            v-model="start"
            autocomplete="off"
            spellcheck="false"
            type="text"
            placeholder=""
            class="tiwen"
            style="width: 140px"
            disabled
          />页
          <el-button
            type="primary"
            class="btn_"
            @click="toPage('down')"
            v-if="start >= maxStart + 1"
            disabled
          >下一页
          </el-button
          >
          <el-button
            type="primary"
            class="btn_"
            @click="toPage('down')"
            v-if="start < maxStart + 1"
            :disabled=garbage
          >下一页
          </el-button
          >
          <el-button type="primary" class="btn" @click="btn" :disabled=garbage>保存</el-button>
          <el-button type="primary" class="btn" @click="deletejizai" :disabled=garbage
          >删除
          </el-button
          >
        </div>
        <!--v-if="dialogImgVisible"-->
      </div>
      <div id="print-div" class="mainBox" style="height: 1460px">
        <div
          style="
            text-align: center;
            font-size: 24px;
            font-weight: bold;
            margin-bottom: 8px;
          "
        >
          <img src="@/icons/img/changzhi.png" style="width: 30px; height: 30px"/>
          {{ this.$store.state.City }}医院<br/>
          有创动脉血压监测
        </div>
        <div class="warp">
          <div class="one">
            <div
              style="
                display: inline-flex;
                height: 30px;
                line-height: 30px;
                font-size: 14px;
                float: left;
                margin-left: 25px;
                margin-top: 4px;
              "
            >
              姓名：
              <span style="
                  width: 70px;
                  text-align: center;
                  border-bottom: 1px solid rgb(220, 222, 226);
                  height: 30px;
                  margin-right: 5px;
                "
              >{{ this.data.name }}</span>
              性别：
              <span
                style="
              width: 40px;
              text-align: center;
              border-bottom: 1px solid rgb(220, 222, 226);
              height: 30px;
              margin-right: 5px;
            "
              >{{ this.data.sex }}</span
              >
              年龄：
              <span style="
                    width: 60px;
                    text-align: center;
                    border-bottom: 1px solid rgb(220, 222, 226);
                    height: 30px;
                    margin-right: 5px;
                  "
              >{{ this.$store.state.user.severFall.ageOrMonthAge }}</span>
              床号：
              <span style="
              width: 60px;
              text-align: center;
              border-bottom: 1px solid rgb(220, 222, 226);
              height: 30px;
              margin-right: 5px;
            "
              >{{ this.data.bed_code }}</span>
              住院号：
              <span style="
              width: 150px;
              text-align: center;
              border-bottom: 1px solid rgb(220, 222, 226);
              height: 30px;
            "
              >{{ this.data.visit_id }}</span>
            </div>
            <div
              style="
                display: inline-flex;
                height: 30px;
                line-height: 30px;
                font-size: 14px;
                float: left;
                margin-left: 25px;
              "
            >
              诊断：
              <span style="
                display: inline-block;
                width: 600px;
                text-align: left;
                border-bottom: 1px solid rgb(220, 222, 226);
                height: 30px;
              "
              >{{ this.data.diagnosis_name }}</span>
            </div>
          </div>
          <div class="two">
            <el-table
              :data="tableData1"
              border
              style="width: 48%; float: left"
              class="feijizaizi"
              @row-click="rowClick1"
              :row-class-name="tableRowClassName"
              :cell-class-name="cellClassName"
            >
              <el-table-column prop="date" label="时间" width="194">
                <template slot-scope="scope">
                  <el-date-picker
                    v-model="scope.row.dataTime"
                    type="datetime"
                    value-format="yyyy-MM-dd HH:mm:ss"
                    class="dazuihouzi"
                    style="text-align: left; width: 150px"
                  />
                </template>
              </el-table-column>
              <el-table-column prop="name" label="ABP(mmHg)" width="185">
                <template slot-scope="scope">
                  <el-input
                    v-model="scope.row.content"
                    name="data_time"
                    class="mugluanz"
                  />
                </template>
              </el-table-column>
              <el-table-column prop="" label="签名" width="135">
                <template slot-scope="scope">
                  <el-select
                    v-if="editIndex1 == scope.$index"
                    v-model="scope.row.signature"
                    placeholder=""
                    filterable
                    :filter-method="signFilter"
                  >
                    <el-option
                      v-for="item in signOptions"
                      :key="item.id"
                      :label="item.user_name"
                      :value="item.user_name"
                    />
                  </el-select>
                  <span v-if="editIndex1 != scope.$index">{{
                      scope.row.signature
                    }}</span>
                </template>
              </el-table-column>
            </el-table>
            <el-table
              :data="tableData2"
              border
              style="width: 48%; float: left"
              class="feijizaizitwo"
              @row-click="rowClick2"
              :row-class-name="tableRowClassName"
              :cell-class-name="cellClassName"
            >
              <el-table-column prop="date" label="时间" width="194">
                <template slot-scope="scope">
                  <el-date-picker
                    v-model="scope.row.dataTime"
                    type="datetime"
                    value-format="yyyy-MM-dd HH:mm:ss"
                    class="dazuihouzi"
                    style="text-align: left; width: 150px"
                  />
                </template>
              </el-table-column>
              <el-table-column prop="name" label="ABP(mmHg)" width="185">
                <template slot-scope="scope">
                  <el-input
                    v-model="scope.row.content"
                    name="data_time"
                    class="mugluanz"
                  />
                </template>
              </el-table-column>
              <el-table-column prop="" label="签名" width="135">
                <template slot-scope="scope">
                  <el-select
                    v-if="editIndex2 == scope.$index"
                    v-model="scope.row.signature"
                    placeholder=""
                    filterable
                    :filter-method="signFilter"
                  >
                    <el-option
                      v-for="item in signOptions"
                      :key="item.id"
                      :label="item.user_name"
                      :value="item.user_name"
                    />
                  </el-select>
                  <span v-if="editIndex2 != scope.$index">{{
                      scope.row.signature
                    }}</span>
                </template>
              </el-table-column>
            </el-table>
          </div>
        </div>
        <!--<div style="text-align:center;margin-top: 1px;">第{{this.start}}页</div>-->
        <div style="text-align: center; margin-top: 1px">
          第{{ this.pageNum }}页
        </div>
      </div>
    </el-card>
  </div>
</template>

<script>
import {jyxdPagePrint} from "@/utils/jyxd-page-printer.js";
import {
  getUserListByUserTypegetNurseList,
  abpInsertNew,
  getABPDataByPageSizeAndPatientId,
  patientgetList,
  abpDelete, findPage,
} from "@/api/table";

export default {
  data() {
    return {
      pageNum: 1,
      pageStartNumber: "",
      luoxuanshanguanggou: "",
      garbage: false,
      age: "",
      printParam: {
        print_id: "print-div", //完整打印区域最外包裹, id名
        paper_height: "1340", //纸张长度，目前不自动分页，页面代码自行设计分页模式
        paper_width: "850", //纸张宽度，根据横向纵向调整，影响页面折行效果
        preview: "",
      },
      editIndex1: -1,
      editIndex2: -1,
      daqingwa: "",
      start: 1,
      maxStart: 1,
      pageSize: 48,
      heimeisu: "",
      tableData1: [
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
      ],
      tableData2: [
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
      ],
      paramList: {
        list: [],
        patientId: "",
        dateTime: "",
      },
      dateTime: "",
      dialogVisible: false,
      data: {},
      listArr: [],
      arrUserName: [],
      signOptions: [],
      yinping: "",
      table: false,
      listarrs: [],
      gridData: [],
      selectLoading: false,
    };
  },
  watch: {
    //页码属性
    pageStartNumber() {
      var pageStart = "";
      if (this.pageStartNumber == "") {
        pageStart = 0;
      } else {
        pageStart = this.pageStartNumber - 1;
      }
      this.pageNum = parseInt(pageStart) + parseInt(this.start);
    },
    start() {
      var pageStart = "";
      if (this.pageStartNumber == "") {
        pageStart = 0;
      } else {
        pageStart = this.pageStartNumber - 1;
      }
      this.pageNum = parseInt(pageStart) + parseInt(this.start);
    },
  },
  created() {
    this.data = this.$store.state.user.severFall;
    if (typeof this.data.patient_id != "string" || this.data.patient_id.length < 1) {
      alert("请选择一次病人");
    } else {
      this.huli();
    }
  },
  methods: {
    signFilter(val) {
      this.value = val;
      if (val) { //val存在
        this.signOptions = this.arrUserName.filter((item) => {
          if (item.user_name.indexOf(val) >= 0 || item.login_name.indexOf(val) >= 0) {
            return true
          }
        })
      } else { //val为空时，还原数组
        Object.assign(this.signOptions, this.arrUserName);
      }
    },

    //设置页码
    findPageByPatientId() {
      findPage({
        patientId: this.data.patient_id,
      }).then((res) => {
        if (res.data != null && res.data.length > 0) {
          this.pageStartNumber = res.data[0].pageNum;
        } else {
          this.pageStartNumber = "";
        }
        console.log(this.pageStartNumber)
      });
    },
    huli() {
      if (
        this.data.unplanned == "" ||
        this.data.unplanned == null ||
        this.data.unplanned == 0
      ) {
        this.garbage = true;
        alert('请在首页补全患者信息')

        return;
      } else {
        this.garbage = false;
      }

      patientgetList({visitId: this.data.visit_id}).then((res) => {
        this.age = res.data[0].age;
        this.heimeisu = res.data[0].diagnosis_name;
      });
      //获取签名列表
      getUserListByUserTypegetNurseList({
        deptCode: this.$store.state.user.loginInfo.deptCode
      }).then((res) => {
        this.arrUserName = res.data;
        Object.assign(this.signOptions, res.data);
      });

      this.paramList = {
        list: [],
        patientId: "",
        dateTime: "",
      },

      this.paramList.patientId = this.data.patient_id,
      this.tableData1 = [
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
      ],
      this.tableData2 = [
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dateTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
        {
          dataTime: "",
          content: "",
          signature: "",
          rowId: "",
          id: "",
          relevancyId: "",
        },
      ];
      this.getABPDataByPageSizeAndPatientId(
        this.start,
        this.pageSize,
        this.data.patient_id
      );
      //设置页码
      this.findPageByPatientId();
    },
    rowClick1(row, column, ev) {
      this.luoxuanshanguanggou = row.id;
      this.editIndex2 = -1;
      this.editIndex1 = row.index;
      row.signature = this.$store.state.user.name;
    },
    rowClick2(row, column, ev) {
      this.luoxuanshanguanggou = row.id;
      this.editIndex1 = -1;
      this.editIndex2 = row.index;
      row.signature = this.$store.state.user.name;
    },
    deletejizai() {
      if (this.luoxuanshanguanggou == "") {
        alert("请先保存数据并选择要删除的数据");
      } else {
        this.$confirm("是否删除此条数据?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        })
          .then(() => {
            abpDelete({id: this.luoxuanshanguanggou}).then((res) => {
              this.getABPDataByPageSizeAndPatientId(
                this.start,
                this.pageSize,
                this.data.patient_id
              );
            });
            this.$message({
              type: "success",
              message: "删除成功!",
            });
          })
          .catch(() => {
            this.$message({
              type: "info",
              message: "已取消删除",
            });
          });
      }
    },
    tableRowClassName({row, rowIndex}) {
      //把每一行的索引放进row
      if (typeof row == "undefined") return "";
      row.index = rowIndex;
    },
    cellClassName({row, column, rowIndex, columnIndex}) {
      row.index = rowIndex;
      column.col = columnIndex;
    },
    //翻页
    toPage(page) {
      if (page == "up") {
        this.start = this.start - 1;
      } else {
        this.start = this.start + 1;
      }
      this.editIndex1 = -1;
      this.editIndex2 = -1;
      this.getABPDataByPageSizeAndPatientId(
        this.start,
        this.pageSize,
        this.data.patient_id
      );
    },
    //通过条数和患者id查询最大页数和页面展示的数据
    getABPDataByPageSizeAndPatientId(start, size, patientId) {
      this.editIndex1 = -1;
      this.editIndex2 = -1;
      var data = {
        dataTime: "",
        content: "",
        signature: "",
        rowId: "",
        id: "",
        relevancyId: "",
      };
      getABPDataByPageSizeAndPatientId({
        start: start,
        size: size,
        patientId: patientId,
      }).then((res) => {
        if (res.code === 200) {
          var table1 = res.data.data.slice(0, 24);
          var table2 = res.data.data.slice(24);
          /**
           for (var i = 0; i < table1.length; i++) {
            if((table1[i].dataTime!="" &&  table1[i].dataTime!=null)  &&
              (table1[i].content!="" &&  table1[i].content!=null)  &&
              (table1[i].signature=="" ||  table1[i].signature==null)
            ){
              table1[i].signature = this.$store.state.user.name;
            }
          }
           for (var j = 0; j < table2.length; j++) {
            if((table2[j].dataTime!="" &&  table2[j].dataTime!=null)  &&
              (table2[j].content!="" &&  table2[j].content!=null)  &&
              (table2[j].signature=="" ||  table2[j].signature==null)
            ){
              table2[j].signature = this.$store.state.user.name;
            }
          }
           **/
          this.tableData1 = table1;
          this.tableData2 = table2;
          this.maxStart = res.data.maxStart;
          this.start = res.data.start;
        }
      });
    },
    //打印
    daying() {
      this.data = this.$store.state.user.severFall;
      if (
        typeof this.data.patient_id != "string" ||
        this.data.patient_id.length < 1
      ) {
        alert("请选择一次病人");
      } else {
        this.editIndex1 = -1;
        this.editIndex2 = -1;
        jyxdPagePrint(this.printParam);
      }
    },
    selectdaqingwa(e) {
      for (var wuma = 0; wuma < this.tableData1.length; wuma++) {
        if (this.tableData1[wuma].signature == "") {
          this.tableData1[wuma].signature = e;
        }
      }
      for (var wuma = 0; wuma < this.tableData2.length; wuma++) {
        if (this.tableData2[wuma].signature == "") {
          this.tableData2[wuma].signature = e;
        }
      }
    },
    //保存
    btn() {
      if (
        typeof this.data.patient_id != "string" ||
        this.data.patient_id.length < 1
      ) {
        alert("请选择一次病人");
      } else {
        this.paramList.patientId = this.data.patient_id;
        this.paramList.list = this.tableData1.concat(this.tableData2);
        const paramList = JSON.parse(JSON.stringify(this.paramList));
        abpInsertNew(paramList).then((res) => {
          if (res.code === 200) {
            this.editIndex1 = -1;
            this.editIndex2 = -1;
            this.$message({
              message: "保存成功",
              type: "success",
            });
            this.editIndex1 = -1;
            this.editIndex2 = -1;
            this.getABPDataByPageSizeAndPatientId(
              this.start,
              this.pageSize,
              this.data.patient_id
            );
          } else {
            this.$message({
              message: "保存失败",
              type: "success",
            });
          }
        });
      }
    },
  },
};
</script>

<style scoped>
.xiang {
  position: absolute;
  top: 40px;
  margin-top: 15px;
  display: inline;
}

.nei {
  top: 0;
  position: absolute;
  left: 60px;
  margin-top: 15px;
  display: inline;
}

.tianji {
  float: left;
  margin-top: 6px;
}

.tianjiyouguai {
  float: left;
  margin-top: 6px;
  width: 500px;
}

.tianjiyouguais {
  float: left;
  margin-top: 6px;
  margin-left: 80px;
}

.tianjitwo {
  margin-right: 50px;
  display: inline-block;
}

.tianjitwos {
  margin-top: 10px;
  display: inline-block;
}

.tianjisss {
  display: flex;
  width: 50px;
  margin-top: 6px;
}

::v-deep .el-input__inner {
  height: 30px !important;
  width: 250px;
}

::v-deep .el-tag .el-icon-close {
  width: 0;
  height: 0;
  display: none;
}

::v-deep .el-tag .el-icon-close::before {
  width: 0;
  height: 0;
  display: none;
}

::v-deep .el-tag--small {
  padding: 0 1px;
  color: black;
}

::v-deep .el-input__icon {
  line-height: 32px !important;
}

.line {
  text-align: center;
}

.block {
  position: absolute;
  top: 39px;
  right: 14%;
}

.warp {
  width: 1040px;
  height: auto;
  margin: 0 auto;
}

.one {
  width: 1040px;
  text-align: center;
  height: 70px;
}

.one /deep/ .el-input__inner {
  width: 146px !important;
}

.tiwenfeixing {
  border: 0px;
  border-bottom: 1px solid rgb(220, 222, 226);
  outline: none;
}

.two {
  width: 1040px;
  height: auto;
  display: flex;
}

::v-deep .feijizaizi {
  width: 48%;
}

::v-deep .feijizaizitwo {
  width: 48%;
  margin-left: 10px;
}

.twokou {
  width: 940px;
  height: 185px;
  border-bottom: 1px solid #808695;
}

.twokous {
  width: 940px;
  height: 120px;
  border-bottom: 1px solid #808695;
}

.sanji {
  width: 940px;
  height: 40px;
  line-height: 40px;
}

.twohu {
  width: 940px;
  height: 540px;
}

.dongtai {
  width: 940px;
  height: 90px;
  border-bottom: 1px solid #808695;
  border-top: 1px solid #808695;
}

.dongtaibiaoge {
  width: 940px;
  height: 45px;
}

.laolong {
  width: 847px;
  height: 45px;
  line-height: 45px;
  border-bottom: 1px solid #808695;
}

.laolongguao {
  width: 940px;
  height: 130px;
  line-height: 45px;
  border-bottom: 1px solid #808695;
}

.laolongtwo {
  width: 847px;
  height: 70px;
  line-height: 70px;
  border-bottom: 1px solid #808695;
  float: right;
}

.laolongthree {
  width: 940px;
  height: 30px;
  line-height: 30px;
  border-bottom: 1px solid #808695;
}

.twotwo {
  width: 939px;
  height: 85px;
  border-bottom: 1px solid #808695;
}

.two /deep/ .el-input__inner {
  border: 0px;
}

.dazuihouzi /deep/ .el-input__inner {
  border: 0px;
}

.mugluanz /deep/ .el-input__inner {
  width: 160px;
}

::v-deep .el-table .cell {
  padding-left: 8px;
}

.three {
  width: 940px;
  height: 176px;
  border-bottom: 1px solid #808695;
}

.three /deep/ .el-input__inner {
  border: none;
  width: 220px;
  border-bottom: 1px solid #808695;
}

.four {
  width: 940px;
  height: 159px;
  border-bottom: 1px solid #808695;
}

.five {
  width: 940px;
  height: 240px;
  border-bottom: 1px solid #808695;
}

.six {
  width: 940px;
  height: 126px;
  border-bottom: 1px solid #808695;
}

.seven {
  width: 840px;
  height: 71px;
}

.one /deep/ .el-input__inner {
  border: none;
  width: 120px;
  border-bottom: 1px solid #dcdfe6;
}

.tiwen {
  border: 0px;
  border-bottom: 1px solid rgb(220, 222, 226);
  outline: none;
  text-align: center;
}

::v-deep .el-input__inner {
  height: 30px !important;
  padding-left: 2px;
}

::v-deep .el-input__icon.el-icon-time {
  display: none;
  width: 0;
  height: 0;
}

::v-deep .el-select__caret.el-input__icon.el-icon-arrow-up {
  display: none;
  width: 0;
  height: 0;
}

.che /deep/ .el-checkbox {
  margin-bottom: 10px;
}

.zhuan /deep/ .el-input__inner {
  border: none;
  width: 220px;
  height: 30px;
  border-bottom: 1px solid #dcdfe6;
}

.sp .el-checkbox {
  display: block;
  margin-bottom: 15px;
}
</style>
